package controller

import (
	"poker/pb/proto/common"
	"poker/pb/proto/config"
	"poker/ws"

	"github.com/gogo/protobuf/proto"
	"github.com/smallnest/rpcx/log"
)

// 获取所有道具信息
func GetItemConfig(r *ws.Request) {
	req := &config.ConfigItemReq{}
	res := &config.ConfigItemRes{}

	defer func() {
		res.Code = common.Code_OK
		res.Items = append(res.Items, &config.ConfigItem{
			ItemId: 1,
			Type:   config.ItemType_ITEM_TY_CHIP,
			Name:   "金币",
		})
		if err := r.Send(res); err != nil {
			log.Errorf("get item config response failed, err: %v", err)
		}
	}()

	if err := proto.Unmarshal(r.ByteData, req); err != nil {
		log.Infof("[ERROR] get item config parse req data fail !")
		res.Code = common.Code_Abnormal
		return
	}

	// 数据库拉去数据
}
